package com.woniuxy.service.impl;

import com.woniuxy.dto.EmployerDto;
import com.woniuxy.entity.Employee;
import com.woniuxy.mapper.EmployeeMapper;
import com.woniuxy.service.EmployerService;
import com.woniuxy.vo.EmployerVo;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class EmployerServiceImpl implements EmployerService {


    @NonNull
    private EmployeeMapper employeeMapper;

    @Override
    public Employee selectById(Long id) {
        Employee employee = employeeMapper.selectByPrimaryKey(id);
        return employee;
    }

    @Override
    public int update(Employee employee) {
        employeeMapper.updateByPrimaryKeySelective(employee);
        return 0;
    }

    @Override
    public int deleteEmployerById(Long id) {
        employeeMapper.deleteByPrimaryKey(id);
        return 0;
    }

    @Override
    public List<Employee> selectAll() {

        List<Employee> employees = employeeMapper.selectAllEmployer();
        return employees;
    }

    @Override
    public int insert(Employee employee) {
        employeeMapper.insertSelective(employee);
        return 0;
    }

    @Override
    public List<EmployerVo> selectByLike(EmployerDto employerDto) {
        return employeeMapper.selectByLike(employerDto);
    }
}
